<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

</head>
<style>
    html body {
        margin: 0;
        padding: 0;
        width: 100vw;
        height: 100vh;
        background-color: #000;
    }

    h1 {
        text-align: center;
        margin: 0;
        padding: 0;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        font-size: 5rem;
        font-weight: 900;
      
    }

    .home {
        background-color: #000;
        width: 100vw;
        height: 100vh;
    }

    .time {
        color: #fff;

    }



    h2 {
        width: 100vw;
        text-align: center;
        margin: 0;
        padding: 0;
        position: fixed;
        bottom: 30vh;
        transform: translate(-50%, -50%);
        transform: scale(2);
        font-weight: 900;

    }
</style>

<body>
    <div class="home">
        <div class="time">
        </div>

    </div>
</body>
<script>

    setInterval(function () {

        document.querySelector(".time").innerHTML = "<h1>" + getDate() + "</h1>"


    }, 1000)



    function getDate() {
        var dt = new Date("2020/12/26 00:00");
        console.log(dt.getTime())
        let db2 = new Date()
      
        let ret = dt.getTime() - db2.getTime();
        const oneDay = 24 * 60 * 60 * 1000;
        const onehour = 60 * 60 * 1000;
        const onemins = 60 * 1000;
        const onseconds = 1000;
        let fin_day = Math.floor(ret / oneDay)
        let ret_hours = ret - (oneDay * fin_day)//总毫秒数-减去50天的毫秒数
        let fin_hour = Math.floor(ret_hours / onehour)
        let ret_mins = ret_hours - (fin_hour * onehour)//减去小时的毫秒数
        let fin_mins = Math.floor(ret_mins / onemins)
        let ret_secs = ret_mins - (fin_mins * onemins)
        let fin_secs = Math.floor(ret_secs / onseconds)
        
        let timetip =  fin_day + "天" + fin_hour + "小时" + fin_mins + "分钟" + fin_secs + "秒"
        return timetip
    }
</script>

</html>